import java.util.Arrays;
import java.util.Locale;

public class Test {

    public static void main(String[] args) {
        char[] chars = {'h','e','l','l','o'};
        String s1 = new String(chars);
        s1.intern();

        String s2 = "hello";

        System.out.println(s1 == s2);
    }

    public static void main10(String[] args) {
        String s1 = "   hello world   ";
        String ret = s1.trim();
        System.out.println(ret);
    }

    public static void main9(String[] args) {
        String s1 = "hello world";
        String ret = s1.substring(5);
        System.out.println(ret);

        String ret2 = s1.substring(0,5);
        System.out.println(ret2);
    }

    public static void main8(String[] args) {
        String s1 = "hello world hi java";
        String[] ret = s1.split(" ");
        for (String x : ret) {
            System.out.println(x);
        }

        System.out.println("===========================");

        String s2 = "hello world hi java";
        String[] ret2 = s1.split(" ", 2);
        for (String x : ret2) {
            System.out.println(x);
        }
    }

    public static void main7(String[] args) {
        String s1 = "hello world";
        String ret = s1.replaceAll("l", "0");
        System.out.println(ret);

        String s2 = "hello world";
        String ret2 = s2.replaceFirst("l", "6");
        System.out.println(ret2);
    }

    public static void main6(String[] args) {
        String s1 = String.format("%d-%d-%d", 2025,10,30);
        System.out.println(s1);
    }

    public static void main5(String[] args) {
        String s1 = "hello";
        char[] chars = s1.toCharArray();
        System.out.println(Arrays.toString(chars));
    }

    public static void main4(String[] args) {
        String s1 = "hello";
        String ret1 = s1.toUpperCase();
        System.out.println(ret1);

        String s2 = "WoRlD";
        String ret2 = s2.toLowerCase();
        System.out.println(ret2);
    }

    public static void main3(String[] args) {
        String s1 = String.valueOf(10);
        String s2 = String.valueOf('c');
        String s3 = String.valueOf(3.15);
        String s4 = String.valueOf(true);
        String s5 = String.valueOf(new Test());

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
        System.out.println(s5);

        int a = Integer.parseInt("100");
        double b = Double.parseDouble("3.14");
        boolean c = Boolean.parseBoolean("false");
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
    }

    public static void main2(String[] args) {
        String s = "abcabcabcabc";
        System.out.println(s.charAt(2));

        System.out.println(s.indexOf('c'));
        System.out.println(s.indexOf('c',3));

        System.out.println(s.indexOf("bca"));

        System.out.println(s.indexOf("ca",3));

        System.out.println(s.lastIndexOf('b'));

        System.out.println(s.lastIndexOf("abc", 8));

        System.out.println(s.lastIndexOf('b', 8));

        System.out.println(s.lastIndexOf("abc"));
    }

    public static void main1(String[] args) {
        String s1 = "abc";
        String s2 = "abc";
        System.out.println(s1 == s2);

        String s3 = new String("hello");
        String s4 = new String("hello");
        System.out.println(s3 == s4);

        System.out.println(s3.equals(s4));

        String s5 = new String("hi");
        String s6 = new String("he");
        System.out.println(s5.compareTo(s6));

        String s7 = new String("world");
        String s8 = new String("WORld");
        System.out.println(s7.compareToIgnoreCase(s8));
    }
}
